home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_11
/
8n11072a
< prev
next >
Wrap
Text File
|
1990-09-22
|
2KB
|
54 lines
/****************** LISTING 1 - ipc.h ******************/
#include <stdio.h>
#include <descrip.h> /* Pass-by-descriptor structures */
#include <ssdef.h> /* System services definitions */
#include <psldef.h> /* Processor status longword def's */
#include <iodef.h> /* I/O services definitions */
#define ADDMBX 0 /* Add server-client mailbox */
#define DELMBX 1 /* Delete server-client mailbox */
#define PASSTHRU 2 /* Pass message to other client */
#define BROADCAST 3 /* Broadcast to all clients */
#define SHUTDOWN 4 /* Shutdown */
#define MAX_NO_PROCESS 10 /* maximum clients */
#define QSIZE (2 * MAX_NO_PROCESS) /* Rcv queue size */
#define RCVEF 1 /* Receive event flag */
/*====== structure for final I/O completion (QIO) ========*/
typedef struct {
USHORT status; /* completion status */
USHORT bytcnt; /* bytes transferred */
ULONG sndPID; /* sender's PID */
} IO_STATUS_BLOCK;
/*================ Message buffer ========================*/
typedef union {
int array[100];
char text[100];
} MSG;
typedef struct {
int cmdtyp; /* server command type */
int msgtyp; /* message type */
int xmt_prcnum; /* sender's process number */
int rcv_prcnum; /* receiver's process number */
MSG msg; /* msg buffer: int or text */
} MSGBUF;
typedef struct {
IO_STATUS_BLOCK iosb;
MSGBUF msg;
} RCVBUF;
/*================= Process buffer =======================*/
typedef struct {
ULONG prcnum; /* process number */
USHORT mbxid; /* mailbox id */
struct CLIENT *link; /* next in list */
} CLIENT;